package org.ihelpuoo.io;

import java.io.IOException;
import java.io.InputStream;

public class BOBInputStream extends InputStream
{

	public BOBInputStream(InputStream ins, int c)
	{
		this.ins = new PreInputStream(this,ins,c);
	}

	private InputStream	ins;

	@Override
	public int read() throws IOException
	{
		return ins.read();
	}

	private class PreInputStream extends InputStream
	{
		private PreInputStream(BOBInputStream parent, InputStream r, int c)
		{
			this.parent = parent;
			this.c = c;
			this.ins = r;
		}

		private BOBInputStream	parent;
		private int				c;
		private InputStream		ins;

		@Override
		public int read() throws IOException
		{
			parent.ins = this.ins;
			return c;
		}
	}

}
